Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
eslint-import-resolver-node
Advanced tools
Node default behavior import resolution plugin for eslint-plugin-import.
The eslint-import-resolver-node package is a resolver for ESLint's import plugin that resolves node modules and paths. It is used to help ESLint understand the resolution of the import statements in a Node.js environment, ensuring that the paths to modules are correctly interpreted according to Node.js module resolution algorithms.
Resolve Node Modules
This feature allows ESLint to resolve import statements for Node modules, taking into account file extensions like .js, .jsx, .ts, and .tsx. The code sample shows how to configure the resolver in the ESLint configuration file.
module.exports = {
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
}
};
Custom Module Directory
This feature allows the specification of custom module directories beyond the default 'node_modules'. In the code sample, 'src' is added as an additional directory to look for modules.
module.exports = {
settings: {
'import/resolver': {
node: {
moduleDirectory: ['node_modules', 'src']
}
}
}
};
This package extends ESLint's import resolution to webpack's module resolution. It is similar to eslint-import-resolver-node but specifically tailored for projects using webpack, where the module resolution can be more complex due to webpack's aliases and other features.
Similar to eslint-import-resolver-node, this package is designed to resolve TypeScript modules. It is particularly useful for projects written in TypeScript, as it understands TypeScript-specific paths and module resolution.
This resolver integrates with Babel's module resolver plugin. It is useful for projects that use Babel and have custom module resolution configured in their Babel settings, which might not be natively understood by ESLint.
Default Node-style module resolution plugin for eslint-plugin-import
.
Published separately to allow pegging to a specific version in case of breaking changes.
Config is passed directly through to resolve
as options:
settings:
import/resolver:
node:
extensions:
# if unset, default is just '.js', but it must be re-added explicitly if set
- .js
- .jsx
- .es6
- .coffee
paths:
# an array of absolute paths which will also be searched
# think NODE_PATH
- /usr/local/share/global_modules
# this is technically for identifying `node_modules` alternate names
moduleDirectory:
- node_modules # defaults to 'node_modules', but...
- bower_components
- project/src # can add a path segment here that will act like
# a source root, for in-project aliasing (i.e.
# `import MyStore from 'stores/my-store'`)
or to use the default options:
settings:
import/resolver: node
FAQs
Node default behavior import resolution plugin for eslint-plugin-import.
The npm package eslint-import-resolver-node receives a total of 14,012,960 weekly downloads. As such, eslint-import-resolver-node popularity was classified as popular.
We found that eslint-import-resolver-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.